/*
 * @Author: CQJ
 * @Date: 2022-08-25 20:00:27
 * @LastEditors: CQJ
 * @LastEditTime: 2022-09-06 10:27:07
 * @Description:
 */
import { storage } from '@/utils/storage'
import { reactive } from 'vue'
type Key = string
interface AtlasListState {
  status: number | undefined
  categ_id: string | undefined
  subcateg_id: string | undefined
  price_type: number | undefined
  publish_state: number | undefined
  picture_id: string | undefined
  picture_keyword: string | undefined
  site_id: string | undefined
}

// 状态管理
export const atlasListState = reactive<AtlasListState>({
  status: undefined,
  categ_id: undefined,
  subcateg_id: undefined,
  price_type: undefined,
  publish_state: undefined,
  picture_id: undefined,
  picture_keyword: undefined,
  site_id: undefined
})
// 状态管理
export const statusState = reactive<{ selectedRowKeys: string[] }>({
  selectedRowKeys: []
})
export const resetState = () => {
  let key: keyof AtlasListState
  for (key in atlasListState) {
    atlasListState[key] = undefined
  }
  atlasListState.site_id = storage.get('siteId')
}
